home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 21 / Cream of the Crop 21 (Terry Blount) (October 1996).iso / os2 / fm2_250.zip / install.cmd < prev    next >
OS/2 REXX Batch file  |  1996-09-08  |  49KB  |  1,237 lines

  1. /****************************************************************************
  2.  * FM/2 2.x installation program copyright (c) 1993-96 by M. Kimes          *
  3.  ****************************************************************************
  4.  *                                                                          *
  5.  * This program creates folders to hold program and data objects,           *
  6.  * then creates program objects for each executable.  It only needs to be   *
  7.  * run once (unless you move the FM/2 directory -- see say notes at end).   *
  8.  * Run this program in the FM/2 directory (where you unpacked the archive). *
  9.  *                                                                          *
  10.  ****************************************************************************
  11.  *                                                                          *
  12.  * For unattended installation, call with /UNATTENDED as the first          *
  13.  * argument.  To avoid any WPS associations being set, use the              *
  14.  * /NOASSOC argument.  INSTALL /? for usage help.                           *
  15.  *                                                                          *
  16.  ****************************************************************************/
  17.  
  18. /* Identify ourself */
  19.  
  20. '@Echo off'
  21. 'cls'
  22.  
  23. say'     ┌───────────────────────────────────────────────────────────────────┐'
  24. say'     │                  FM/2 2.x Installation Program                    │'
  25. say'     │             FM/2 is copyright (c) 1993-96 by M. Kimes             │'
  26. say'     │                       All rights reserved                         │'
  27. say'     ├───────────────────────────────────────────────────────────────────┤'
  28. say'     ├───────────────────────────────────────────────────────────────────┤'
  29. say'     │                Have you read the READ.ME file yet?                │'
  30. say'     │        By running this program, you agree to the license          │'
  31. say'     │                     as specified in that file,                    │'
  32. say'     │      and it tells you how to install, so you should read it.      │'
  33. say'     │                             Please?                               │'
  34. say'     └───────────────────────────────────────────────────────────────────┘'
  35.  
  36. assocfilter = ';ASSOCFILTER=*.ZIP,*.ARC,*.LZH,*.ARJ,*.ZOO,*.MO0,READ.ME,README,README.1ST,README.OS2,REGISTER.TXT'
  37.  
  38. /* check arguments and adjust as required */
  39.  
  40. parse upper arg dummy1 dummy2
  41. if dummy1 = '/NOASSOC' then assocfilter = ''
  42. if dummy2 = '/NOASSOC' then assocfilter = ''
  43. if assocfilter = '' then say '     /NOASSOC = TRUE'
  44.  
  45. if dummy1 = '/UNATTENDED' then unattended = ''
  46. if dummy2 = '/UNATTENDED' then unattended = ''
  47. if unattended = '' then say '     /UNATTENDED = TRUE'
  48.  
  49. /* if user asked for usage help, give it */
  50.  
  51. if dummy1 = '/?' | dummy2 = '/?' then
  52. do
  53.   say ''
  54.   say 'Usage:  INSTALL [/NOASSOC] [/UNATTENDED]'
  55.   say ' /NOASSOC    = don''t set any WPS associations'
  56.   say ' /UNATTENDED = don''t ask any questions'
  57.   say ''
  58.   say 'Examples:'
  59.   say ' INSTALL'
  60.   say ' INSTALL /NOASSOC'
  61.   say ' INSTALL /UNATTENDED'
  62.   say ' INSTALL /NOASSOC /UNATTENDED'
  63.   exit
  64. end
  65.  
  66. /* see if we might be in the right directory... */
  67.  
  68. rc = stream('fm3.exe','c','query exists')
  69. if rc = '' then
  70. do
  71.   say 'Sorry, FM3.EXE not found.  Must not be right directory.  Terminating.'
  72.   exit
  73. end
  74.  
  75. /* tell user what we're doing */
  76.  
  77. say ''
  78. say 'This program creates objects for FM/2 and does some drudgework for you.'
  79. say ''
  80.  
  81. /* load rexx utility functions */
  82.  
  83. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  84. call SysLoadFuncs
  85.  
  86. /* give user a chance to hit CTRL-C */
  87.  
  88. if unattended = 'UNATTENDED' then
  89. do
  90.   call charout ,'  Press [Enter] to continue...'
  91.   dummy = ''
  92.   do until dummy = '0d'x
  93.     dummy = SysGetKey('NOECHO')
  94.   end
  95.   call charout ,'0d1b'x'[K'
  96. end
  97.  
  98. /* save current directory */
  99.  
  100. curdir = directory()
  101.  
  102. /* say it, then do it */
  103.  
  104. say "Creating File Manager/2 folders and objects..."
  105.  
  106. /* first, create FM/2 folder */
  107.  
  108. rc = stream('fm2fldr.ico','c','query exists')
  109. title = "File Manager/2"
  110. classname = 'WPFolder'
  111. location = '<WP_DESKTOP>'
  112. setup = ''
  113. if rc \= '' then setup = 'ICONFILE='rc';'
  114. setup = setup'OBJECTID=<FM3_Folder>'
  115. result = SysCreateObject(classname,title,location,setup,f)
  116.  
  117. if unattended = 'UNATTENDED' then
  118. do
  119.   if result = 0 then
  120.   do
  121.     assocfilter = ''
  122.     existed = ''
  123.     say ''
  124.     say 'The File Manager/2 folder already exists.'
  125.     call charout ,"Should I update the objects (it's painless)? (Y/N) "
  126.     dummy = ''
  127.     do forever
  128.       dummy = SysGetKey('NOECHO')
  129.       parse upper var dummy dummy
  130.       if dummy = '1b'x then dummy = 'N'
  131.       if dummy = '0d'x then dummy = 'Y'
  132.       if dummy = 'N' then leave
  133.       if dummy = 'Y' then leave
  134.     end
  135.     call charout ,dummy
  136.     say ''
  137.     if dummy = 'N' then exit
  138.   end
  139. end
  140. else
  141. do
  142.   if result = 0 then
  143.   do
  144.     assocfilter = ''
  145.     existed = ''
  146.     say 'Updating objects.'
  147.   end
  148. end
  149.  
  150. /* create objects in appropriate folders */
  151.  
  152. rc = stream('fm3.exe','c','query exists')
  153. if rc \= '' then
  154. do
  155.   title = "FM/2"
  156.   classname = 'WPProgram'
  157.   location = '<FM3_Folder>'
  158.   setup = 'EXENAME='rc';STARTUPDIR='curdir
  159.   if existed = 'EXISTED' then setup = setup';PARAMETERS=%*'
  160.   setup = setup';OBJECTID=<FM/2>'
  161.   call SysCreateObject classname,title,location,setup,u
  162. end
  163.  
  164. rc = stream('fm4.exe','c','query exists')
  165. if rc \= '' then
  166. do
  167.   title = "FM/2 Lite"
  168.   classname = 'WPProgram'
  169.   location = '<FM3_Folder>'
  170.   setup = 'EXENAME='rc';STARTUPDIR='curdir
  171.   if existed = 'EXISTED' then setup = setup';PARAMETERS=%*'
  172.   setup = setup';OBJECTID=<FM/2 LITE>'
  173.   call SysCreateObject classname,title,location,setup,u
  174. end
  175.  
  176. /* create toolbox folder in FM/2 folder */
  177. rc = stream('toolbox.ico','c','query exists')
  178. title = "FM/2 Tools"
  179. classname = 'WPFolder'
  180. location = '<FM3_Folder>'
  181. setup = ''
  182. if rc \= '' then setup = 'ICONFILE='rc';'
  183. setup = setup'OBJECTID=<FM3_Tools>'
  184. result = SysCreateObject(classname,title,location,setup,u)
  185.  
  186. /* create documentation folder in FM/2 folder */
  187. rc = stream('docs.ico','c','query exists')
  188. title = "FM/2 Docs"
  189. classname = 'WPFolder'
  190. location = '<FM3_Folder>'
  191. setup = ''
  192. if rc \= '' then setup = 'ICONFILE='rc';'
  193. setup = setup'OBJECTID=<FM3_Docs>'
  194. result = SysCreateObject(classname,title,location,setup,u)
  195.  
  196. rc = stream('av2.exe','c','query exists')
  197. if rc \= '' then
  198. do
  199.   title = "Archive Viewer/2"
  200.   classname = 'WPProgram'
  201.   location = '<FM3_Tools>'
  202.   setup = 'EXENAME='rc';STARTUPDIR='curdir''assocfilter
  203.   if existed = 'EXISTED' then setup = setup';PARAMETERS=%*'
  204.   setup = setup';OBJECTID=<FM/2_AV/2>'
  205.   call SysCreateObject classname,title,location,setup,u
  206. end
  207.  
  208. rc = stream('eas.exe','c','query exists')
  209. if rc \= '' then
  210. do
  211.   title = "EA Viewer"
  212.   classname = 'WPProgram'
  213.   location = '<FM3_Tools>'
  214.   setup = 'EXENAME='rc';STARTUPDIR='curdir
  215.   if existed = 'EXISTED' then setup = setup';PARAMETERS=%*'
  216.   setup = setup';OBJECTID=<FM/2_EAVIEW>'
  217.   call SysCreateObject classname,title,location,setup,u
  218. end
  219.  
  220. rc = stream('dirsize.exe','c','query exists')
  221. if rc \= '' then
  222. do
  223.   title = "Dir Sizes"
  224.   classname = 'WPProgram'
  225.   location = '<FM3_Tools>'
  226.   setup = 'EXENAME='rc';STARTUPDIR='curdir
  227.   if existed = 'EXISTED' then setup = setup';PARAMETERS=%*'
  228.   setup = setup';OBJECTID=<FM/2_DIRSIZE>'
  229.   call SysCreateObject classname,title,location,setup,u
  230. end
  231.  
  232. rc = stream('makearc.exe','c','query exists')
  233. if rc \= '' then
  234. do
  235.   title = "Make Archive"
  236.   classname = 'WPProgram'
  237.   location = '<FM3_Tools>'
  238.   setup = 'EXENAME='rc';STARTUPDIR='curdir
  239.   if existed = 'EXISTED' then setup = setup';PARAMETERS=%*'
  240.   setup = setup';OBJECTID=<FM/2_MAKEARC>'
  241.   call SysCreateObject classname,title,location,setup,u
  242. end
  243.  
  244. rc = stream('ini.exe','c','query exists')
  245. if rc \= '' then
  246. do
  247.   if assocfilter \= '' then assocfilter = ';ASSOCFILTER=*.INI'
  248.   title = "INI Viewer"
  249.   classname = 'WPProgram'
  250.   location = '<FM3_Tools>'
  251.   setup = 'EXENAME='rc';STARTUPDIR='curdir''assocfilter
  252.   if existed = 'EXISTED' then setu